static-lib=libadd.a
dy-lib=libPrintLog.so

.PHONY:all
all:$(static-lib) $(dy-lib)

$(static-lib):add.o
	ar -rc $@ $^

$(dy-lib):print.o log.o
	gcc  -shared -o $@ $^

add.o:add.c
	gcc -c $^

print.o:print.c
	gcc -fPIC -c $^

log.o:log.c
	gcc -fPIC -c $^

.PHONY:clean
clean:
	rm -rf *.o *.a *.so mylib

.PHONY:output
output:
	mkdir mylib
	mkdir -p mylib/include
	mkdir -p mylib/lib
	cp *.h mylib/include
	cp *.so mylib/lib
	cp *.a mylib/lib
